<!--<script type="text/javascript">jQuery.noConflict()</script>-->

<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>media/js/jquery.js"></script>
<script type="text/javascript" language="javascript" src="<?php echo base_url() ?>media/js/jquery.dataTables.js"></script>
<script type="text/javascript" charset="utf-8">
    $(document).ready(function() {
        $('#example').dataTable();
    } );

</script>


<link media="screen" rel="stylesheet" href="<?php echo base_url(); ?>css/colorbox.css" />
<!--<script src="<?php echo base_url(); ?>jscripts/jquery-latest.min.js" type="text/javascript"></script>-->
<script src="<?php echo base_url(); ?>jscripts/jquery.colorbox-min.js" type="text/javascript"></script>

<!--the end of popup-->
<script type="text/javascript">
    $(function()
    {
        $('#link_content').colorbox({opacity:0.3});

    });
</script>
<!--this is the end of stylesheet-->
<!--end search -->

<style type="text/css" title="currentStyle">
    @import "<?php echo base_url() ?>media/css/demo_page.css";
    @import "<?php echo base_url() ?>media/css/demo_table.css";
</style>
<style type="text/css">
    span{ color: red;} 
</style>
<div style="margin: 0 auto;width: 100%;height: auto;border: 0px #ccc solid;text-align: center;font-size: 20px;color:#5C9416;">Attendance Management</div><br/>
<div class="Tcontrol" style="margin: 0 auto; float: right;width:70px;height: auto;border: 1px #ccc solid;text-align: center;font-size: 20px;color:#006600;">
    <center><?php echo anchor('attendance/add', img('images/icon-32-new.png'), array('id' => 'link_content')); ?><br/>
        <span style="font-size: 9px;">Add New</span></center>
</div><br/><br/>
<?php
//--------------this is define condition of sessesion------------------

if ($this->session->userdata('attendance_ms')) {
    echo $this->session->userdata('attendance_ms');
    echo $this->session->unset_userdata('attendance_ms');
} else if ($this->session->userdata('editattendance_ms')) {
    echo $this->session->userdata('editattendance_ms');
    echo $this->session->unset_userdata('editattendance_ms');
} else if ($this->session->userdata('deleteattendance_ms')) {
    echo $this->session->userdata('deleteattendance_ms');
    echo $this->session->unset_userdata('deleteattendance_ms');
}
?>
<div class="task1" style="float: left; width: 100%;height: auto;border: 0px #ccc solid;padding: 5px;">
    <div class="full_width big"></div>
    <div id="demo">
        <table cellpadding="0" cellspacing="0" border="0" class="mytable" id="example" width="100%">
            <thead>
                <tr style="background-color:#5C9416;color:#FFF;border:1px;text-align: center;font-weight: lighter;">
                    <?php
                    $admin = $this->session->userdata('user_type');
                    echo '<th>N&ordm;</th>';
                    echo '<th>Student Name</th>';
                    echo '<th>Teacher Name</th>';
                    echo '<th>Class Time</th>';
                    echo '<th>Class Name</th>';
                    echo '<th>Card Name</th>';
                    echo '<th>Student Type</th>';
                    if ($admin == 1) {
                        echo '<th>Action</td>';
                    }else
                        echo '<th>Action</td>';
                    ?> 
                </tr>
            </thead>
            <tbody>
                <?php
                //---------this is for showing view ----------------------
                if ($value_attendance->num_rows() > 0) {
                    $i = 1;
                    $j = 0;
                    foreach ($value_attendance->result() as $rows) {
                        $j++;
                        echo '<tr style="border:1px;text-align: center;font-weight: lighter;" class="row';
                        echo $j % 2;
                        echo '">';

                        echo '<td>' . $i . '</td>';
                        echo '<td>' . $rows->stu_name . '</td>';
                        echo '<td>' . $rows->tea_name . '</td>';
                        echo '<td>' . $rows->att_time . '</td>';
                        echo '<td>' . $rows->cla_name . '</td>';
                        echo '<td>' . $rows->car_type_name . '</td>';
                        echo '<td>' . $rows->stu_type . '</td>';
                        if ($admin == 1) {
                            echo '<td >' . anchor('attendance/delete/' . $rows->att_id, img(array('src' => 'images/web_images/icon-16-delete2.png', 'alt' => 'Delete', 'title' => 'Delete')), 'title=Delete onclick="return confirm(\'Are you sure you want to delete?\')"') . '|', anchor('attendance/edit/' . $rows->att_id, img(array('src' => 'images/web_images/icon-16-edit2.png', 'alt' => 'Edit', 'title' => 'Edit'))) . '</td>';
                        }else
                            echo '<td>' . anchor('attendance/edit/' . $rows->att_id, img(array('src' => 'images/web_images/icon-16-edit2.png', 'alt' => 'Edit', 'title' => 'Edit'))) . '</td>';
                        echo '</tr>';
                        $i++;
                    }
                } else {
                    echo '<tr><td colspan="8" style="text-align:center; color:#F00;">Don\'t have any attendance.</td></tr>';
                }
                ?>
            </tbody>
        </table>
    </div>
    <div class="spacer"></div>


    <h1>&nbsp;</h1>
    <h1>&nbsp;</h1>
</div>

